Magic function `bash ` not found

Posted by inspectorG4dget on Stack Overflow See other posts from Stack Overflow or by inspectorG4dget
Published on 2012-12-08T04:49:58Z Indexed on 2012/12/08 5:04 UTC
Read the original article Hit count: 263

Filed under:
|
|

I have a bunch of simulations that I want to run on a high-performance cluster, on which I should make reservations to get computing time. Since the reservations are bounded by time, I am developing an automation script that I can scp into the cluster and run. This script will then download the relevant simulation files, run them, and upload the results.

Part of this automation script is in bash (cp, scp, etc) and the rest is in python. In order to develop this automation, I am using an IPython notebook.

So far, I've coded all the python automation stuff in my IPython notebook and am trying to write the bash part of it now.

However, it seems that the magic %%bash doesn't work in my IPython notebook. I get the following error when I have this code in my cell:


Cell

%%bash

echo hi

Error

  File "<ipython-input-22-62ec98e35224>", line 3
    echo hi
          ^
SyntaxError: invalid syntax

On a whim, I tried this:


Cell

%%bash

print "hi"

Error

hi
ERROR: Magic function `bash` not found.

So I tried this with %%system, %%! and %%shell. But none of those work; they all give me the same error.

Why is this happening? How can I fix this?

Metadata:

  • IPython 0.13.dev
  • Python 2.7.1
  • Mac OS X Lion

© Stack Overflow or respective owner

Related posts about bash

Related posts about ipython